<?php

declare(strict_types=1);

namespace App\Service;

use App\Model\AppUser;

class AppUserService extends BaseService
{

    /**
     * 获取用户信息
     * @param int $user_id
     * @return array
     */
    public function getUserInfo(int $user_id): array
    {
        $user = $this->getModelInstance()->find($user_id);
        return empty($user) ? [] : $user->toArray();
    }

    /**
     * 获取adminId的用户模型
     * @param int $user_id
     * @return Builder|Model|object|null
     */
    public function getUserInfoModel(int $user_id)
    {
        return AppUser::query(true)
            ->where('id',$user_id)->first();
    }
}